package servlets.tools;

import dao.IdaoLocal;
import entities.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * eCOM - Adopte un Presta - Mars-Avril 2013
 * @author Kheira, Jef, William, Tuan-Long
 */
public class Cart_calcTotalPrice {

    public Cart_calcTotalPrice() {
    }
    
    public Double getTotalPrice(List<Product> prds) {
        Double result = new Double("0");
        
        if (prds != null) 
        {
            Iterator<Product> itp = prds.iterator();
            
            while (itp.hasNext()) 
            {
               Product p_tmp = itp.next();
               result += p_tmp.getPrix();
            }
        }
        
        return result;
    }
}
